#include "RGame.h"
#include "ShareComponents.h"
#include "RSManager.h"
#include "Camera.h"
#include "MainGame.h"
#include "PauseScene.h"
#include "GameOver.h"
#include "MiddleScene.h"

RGame::RGame(HINSTANCE hIns, char* windowName, int w, int h) : FWGame(hIns, windowName, w, h)
{

}


RGame::~RGame()
{
}
void RGame::load()
{

	_graphics = new FWGraphic(this);
	_graphics->init();
	_graphics->initFont();
	_graphics->SetFontSize(D3DXVECTOR2(FONT_WIDTH,FONT_HEIGHT));

	_keyboard = new FWKeyboard(this);
	_keyboard->init();
	_content = new FWContentManager(this);

	gl_keyboard = _keyboard;
	gl_graphic = _graphics;
	gl_content = _content;

	RSManager::getInstance()->Init();
	state_manager = StateManager::getInstance();	
	 	//MenuScene* m = new MenuScene(this); 	
	  //	m->load();	
	MainGame* m = new MainGame(this);
	m->load();
	state_manager->addScene(m);
}
void RGame::update(float time)
{
	_keyboard->getState();
	state_manager->getCurrentScene()->update(time);
	_keyboard->saveState();

}
void RGame::render()
{	
	state_manager->getCurrentScene()->render();
}
void RGame::shutdown()
{

}